package com.weiadmin.controller.system;

import com.weiadmin.common.BaseController;
import com.weiadmin.model.Order;
import com.weiadmin.repository.OrderRepository;
import com.weiadmin.response.RestResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * 功能描述
 * 订单关联查询
 *
 * @author: shizhongyu
 * @date: 2023年03月18日 18:20
 */
@RestController
@RequestMapping("/api/order")
public class OrderController extends BaseController {
    @Autowired
    private OrderRepository orderRepository;

    @GetMapping("/list")
    public ResponseEntity<?> list() {
        List<Order> list = orderRepository.findAll();
        RestResponse<List<Order>> response = new RestResponse<>();
        return response.success("请求成功", list);
    }

    @GetMapping("/login")
    public ModelAndView login() {
        return display("login");
    }

    @GetMapping("/main")
    public ModelAndView mian() {
        return display("main");
    }

    @GetMapping("/index")
    public ModelAndView index() {
        return display("index");
    }

}
